/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author 7P7
 */
@Entity
@Table(name = "CardType", catalog = "NationalLevelPaperPresentation", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CardType.findAll", query = "SELECT c FROM CardType c"),
    @NamedQuery(name = "CardType.findByCardTypeID", query = "SELECT c FROM CardType c WHERE c.cardTypeID = :cardTypeID"),
    @NamedQuery(name = "CardType.findByCardTypeName", query = "SELECT c FROM CardType c WHERE c.cardTypeName = :cardTypeName")})
public class CardType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "CardTypeID", nullable = false)
    private Integer cardTypeID;
    @Size(max = 50)
    @Column(name = "CardTypeName", length = 50)
    private String cardTypeName;
    @OneToMany(mappedBy = "cardTypeID")
    private Collection<Person> personCollection;

    public CardType() {
    }

    public CardType(Integer cardTypeID) {
        this.cardTypeID = cardTypeID;
    }

    public Integer getCardTypeID() {
        return cardTypeID;
    }

    public void setCardTypeID(Integer cardTypeID) {
        this.cardTypeID = cardTypeID;
    }

    public String getCardTypeName() {
        return cardTypeName;
    }

    public void setCardTypeName(String cardTypeName) {
        this.cardTypeName = cardTypeName;
    }

    @XmlTransient
    public Collection<Person> getPersonCollection() {
        return personCollection;
    }

    public void setPersonCollection(Collection<Person> personCollection) {
        this.personCollection = personCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cardTypeID != null ? cardTypeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CardType)) {
            return false;
        }
        CardType other = (CardType) object;
        if ((this.cardTypeID == null && other.cardTypeID != null) || (this.cardTypeID != null && !this.cardTypeID.equals(other.cardTypeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.CardType[ cardTypeID=" + cardTypeID + " ]";
    }
    
}
